<template>
    <div style="padding: 0 40px;">
        <div style="font-size: 26px;font-weight: bold;margin: 20px 0;">{{ notice.name }}</div>
        <div>{{ notice.createTime }}</div>
        <div v-html="notice.content"></div>
    </div>
</template>
<script>
export default {
    data() {
        return {
            notice: null
        }
    },
    created() {
        const jsonNotice = sessionStorage.getItem('noticeInfo');
        this.notice = JSON.parse(jsonNotice);
        this.listener();
    },
    methods: {
        listener() {
            setInterval(() => {
                const jsonNotice = sessionStorage.getItem('noticeInfo');
                if (JSON.stringify(this.notice) !== jsonNotice) {
                    this.notice = JSON.parse(jsonNotice);
                }
            }, 1000)
        },
    }
};
</script>

<style scoped lang="scss"></style>